<?php

namespace app\admin\model\kpxt;

use think\Model;

class Kpinfo extends Model
{
    // 表名
    protected $name = 'kpxt_kpinfo';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    
    // 追加属性
    protected $append = [
        'pzlx_text',
        'state_text'
    ];
    

    
    public function getPzlxList()
    {
        return ['增值税普票' => __('增值税普票'), '增值税专票' => __('增值税专票')];
    }     

    public function getStateList()
    {
        return ['待开' => __('待开'),'已开' => __('已开')];
    }     


    public function getPzlxTextAttr($value, $data)
    {        
        $value = $value ? $value : (isset($data['pzlx']) ? $data['pzlx'] : '');
        $list = $this->getPzlxList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getStateTextAttr($value, $data)
    {        
        $value = $value ? $value : (isset($data['state']) ? $data['state'] : '');
        $list = $this->getStateList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
